/**
 * 对于首页轮播图获取
 */
//导入相应的库
import express from 'express';

//导入数据库连接
import conn from './../db/db'

/**
 * 
 * @param {express.Request} req 
 * @param {express.Response} res 
 */
function getHomecasual(req,res){
    let sqlStr = 'SELECT * FROM homecasual';
    conn.query(sqlStr, (error, results, fields) => {
        if (error) {
            res.json({err_code: 0, message: '请求轮播图数据失败'});
            console.log(error);
        } else {
            results = JSON.parse(JSON.stringify(results));
            res.json({success_code: 200, message: results});
        }
    });

}

export default {
  getHomecasual
}